#include "QFileNameListView.h"
#include "qstringlistmodel.h"


QFileNameListView::QFileNameListView(QString *selectedFilter,QWidget *parent):QListView(parent)
{
	this->setSelectionMode(QAbstractItemView::SingleSelection);

	this->setDragDropMode(QAbstractItemView::InternalMove);
	this->setViewMode(QListView::ListMode);
	this->setAutoScroll(true);
	//qv->setAcceptDrops(false);
	this->setDragEnabled(true);
	this->setDragDropOverwriteMode(false);
	this->setDropIndicatorShown(true);
	this->selectedFilter=selectedFilter;

}


QFileNameListView::~QFileNameListView(void)
{
}


void QFileNameListView::mousePressEvent( QMouseEvent * e )
{
	QListView::mousePressEvent(e);
	QModelIndexList mll = this->selectedIndexes();
	QModelIndex qml = mll.first();
	int i = qml.row();
	QStringListModel * lm = (QStringListModel * )(this->model());
	QString s =lm->stringList().at(i);
	if (selectedFilter == QString::fromLocal8Bit("DICOM Files (*.*)"))
		return;
	emit listViewMousePressed(s);
	
}

QStringList QFileNameListView::getFileList( void )
{
	QStringListModel * lm = (QStringListModel * )(this->model());
	return lm->stringList();
}


